1. Technical Field
The present invention relates to a method and apparatus for reading and writing data in a disk drive system, and in particular to a method and apparatus for rearranging the data stored on a disk into continuous locations after reading the data.
2. Description of the Background Art
Typically, the host computer, hereinafter referred to as host, controls the storage location of data on a disk drive, such as a hard disk drive. A file is comprised of data sets. In particular, the host specifies the cylinder, head, and sector addresses of each data constituting a file, hereinafter referred to as a data set, stored on the hard disk, then reads or writes the file. Under host control, the data sets are recorded on a predetermined area of the disk corresponding to the cylinder, head, and sector addresses.
Since the host controls the location of data recorded on the disk, the data sets are recorded physically discretely. Recording data physically discretely means that the data are not recorded on continuous sectors of the disk. Because the data sets are recorded physically discretely, a longer seek time is needed to read and write one file.
PUPA 4-5723 proposes a disk drive provided with a relatively large capacity buffer which uses a cache to store data previously read from the hard disk in the buffer.
If the above-described disk drive receives a read command from the host, it checks whether the data requested by the host is stored in the buffer. If the data is not stored in the buffer, the data is transferred from the hard disk to the host. Based on the transferred data, the disk drive predicts the data that the host will next request, and stores the predicted data in the buffer. If the disk drive receives a read command from the host for data identical to the predicted data, the disk drive transfers the data from the buffer to the host.
However, even when predicting subsequent read requests by the host, in some cases the host does not send a read command requesting the same data as the predicted data. In such cases, the requested data is read from the disk and transferred to the host. Therefore, if the file was recorded physically discretely, it takes a long period of time to read and write one file.